package com.duanfh.HttpServlet;

import com.duanfh.Request.Request;
import com.duanfh.Response.Response;
import org.apache.log4j.Logger;

public abstract class HttpServlet {
    private static Logger logger = Logger.getLogger(HttpServlet.class);
    private static final String METHOD_GET = "GET";
    private static final String METHOD_POST = "POST";

    public abstract void doGet(Request request, Response response) ;
    public abstract void doPost(Request request, Response response);

    public void service(Request request, Response response){
        if(METHOD_GET.equals(request.getMyMethod())){
            doGet(request,response);
        }else if(METHOD_POST.equals(request.getMyMethod())){
            doPost(request,response);
        }
    }

}
